﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CBE.Services;
using CBE.Model;
using CBE.Model.Entities;
using Common.UI.EM.Views;
using Microsoft.Practices.Composite.Presentation.Commands;
using Common.UI.EM.Views.Interfaces;
using System.Windows;
using CBE.UI.Control.Views;

namespace CBE.UI.Control
{
    public class AdministarTurnosFilterPresentationModel : FilterPresentationModel<AdministrarTurnosService, Turnos, AdministrarTurnosCriteria, AdministrarTurnosView>
    {

        public DelegateCommand<Object> CronogramaCommand
        {
            get;
            set;
        }

        protected override void AddCustomCommands()
        {
            this.CronogramaCommand = new DelegateCommand<object>(ExecuteCronogramaCommand, CanExecuteCronogramaCommand);
        }

        public AdministarTurnosFilterPresentationModel(IFilterView view)
            : base(view)
        {
        }

        private void ExecuteCronogramaCommand(Object arg)
        {
            if (!this.CriteriaEntity.Fecha.HasValue)
            {
                MessageBox.Show("Para generar el cronograma debe seleccionar una fecha.", "CBE", MessageBoxButton.OK, MessageBoxImage.Information);
            }
            else
            {
                CronogramaTurnosWindow view = new CronogramaTurnosWindow(this.CriteriaEntity.Fecha.Value);
                view.ShowDialog();
            }
        }

        private Boolean CanExecuteCronogramaCommand(Object arg)
        {
            return true;
        }

    }
}
